cmake_minimum_required(VERSION 3.13)

project(learn_muduo LANGUAGES C CXX VERSION 1.0.0)

message(STATUS "build_your_owned_redis version: ${PROJECT_VERSION}")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(COMPILEOPTIONS "Enable CompileOptions Support" ON)
if(COMPILEOPTIONS)
	include(ExtraWarnings)
else()
	MESSAGE(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
	MESSAGE(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
endif()

# 系统检测
include(SystemDetection)
# 开发时请注释这一行, 不要屏蔽警告, 追求0Warning
# add_compile_options(-w)

SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../run)

MESSAGE(STATUS "Project source directory: " ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR})

set(ROOT_DIR "${PROJECT_SOURCE_DIR}")
message(STATUS "ROOT_DIR 根目录 - ${ROOT_DIR}")
set(3RD_DIR "${ROOT_DIR}/3rd")
message(STATUS "3RD_DIR 第三方库目录 - ${3RD_DIR}")
set(LIB_DIR "${LIBRARY_OUTPUT_PATH}")
message(STATUS "LIB 产物生成目录 - ${LIB_DIR}")
set(RUN_DIR "${EXECUTABLE_OUTPUT_PATH}")
message(STATUS "EXE 产物生成目录 - ${RUN_DIR}")

add_subdirectory(01_Stages)